<template>
	<view>
		<navTop title="社团相册" :isHeight="false" hasBgc="white" :color="navtop.color" :isBack="true"></navTop>
		<view v-for="(item,index) in imgs">
			<image :src="imgUrl+item.imageId" @click="preview(imgUrl+item.imageId)" class="img" mode="aspectFill"  @load="onoff='1'" v-show="onoff=='1'"></image>
			<image class="img" src="/static/loading.gif" v-show="onoff=='0'" mode="aspectFill"></image>
		</view>
		
	</view>
</template>

<script>
	import navTop from '../../components/navTop.vue'
	export default {
		components: {
			navTop,
			
		},
		data(){
			return{
				navtop: {
					title: 'XXX',
					color: '#000000'
				},
				onoff:0,
				id:'',
				imgs:[],
				imgUrl: 'https://www.codingyt.com/getImage/',
			}
		},
		methods:{
			preview(imgsArray){
				let arr=[];
				arr.push(imgsArray)
				 
				uni.previewImage({
					current:0,
					urls: arr //必须是网址路径，否则加载不出来，如：http：或https：
				})
			},
			goUploadImg(){
				// 记得传参
				uni.navigateTo({
					url:'./uploadImg'
				})
			},
			getAllImages(){
				let that=this
				uni.request({
					url:'https://www.codingyt.com/club/images/select',
					data:{
						getId:that.id,
						getType:'association',
					},
					success(res) {
						that.imgs=res.data.data
						
					},
				})
			},
		},
		onLoad(val) {
			var data=JSON.parse(val.content)
			this.id=data.id
			
			this.getAllImages()
		},
	}
</script>

<style>
	.img{
		left: 44rpx;
		top: 220rpx;
		width: 180rpx;
		height: 102rpx;
		border-radius: 14rpx; 
		position: relative;
		margin-right: 62rpx;
		margin-bottom: 30rpx;
		float: left;
	}
</style>
